import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

/**
 * 拉卡拉访问令牌实体
 */
@Entity('lakala_token')
export class LakalaTokenEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '访问令牌', length: 500 })
  accessToken: string;

  @Column({ comment: '有效期（秒）' })
  expiresIn: number;

  @Column({ comment: '过期时间' })
  expiresAt: Date;

  @Column({ comment: '状态', default: 'active' })
  status: string; // active, expired, revoked

  @Column({ comment: '拉卡拉响应数据', type: 'text', nullable: true })
  response: string;

  @Column({ comment: '备注', nullable: true })
  remark: string;

  @CreateDateColumn({ comment: '创建时间' })
  createdAt: Date;

  @UpdateDateColumn({ comment: '更新时间' })
  updatedAt: Date;
}
